package com.cy.pj.activity.controller;

import com.cy.pj.activity.pojo.Activity;
import com.cy.pj.activity.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class ActivityController {
    @Autowired
    ActivityService activityService;

    @RequestMapping("/findAll")
    @CrossOrigin
    public List<Activity> findAll(){
        return activityService.findAll();
    }

    @PostMapping("/save")
    public void save(@RequestBody Activity activity){
        activityService.insert(activity);
    }
}
